<template>
  <div class="app-container">
    <div class="filter-container">
      <el-form :inline="true" :model="formModel">
        <el-form-item class="no-warn-item" label="合格证编号:" prop="qualifiedCertificateNo">
          <el-input
            v-model="formModel.qualifiedCertificateNo"
            class="filter-item "
            clearable
          />
        </el-form-item>
        <el-form-item class="no-warn-item" label="车辆型号:" prop="clxh">
          <el-input
            v-model="formModel.clxh"
            class="filter-item "
            clearable
          />
        </el-form-item>
        <el-form-item class="no-warn-item" label="转向形式:" prop="zxxs">
          <el-input
            v-model="formModel.zxxs"
            class="filter-item "
            clearable
          />
        </el-form-item>
        <el-form-item class="no-warn-item" label="前轮距(mm):" prop="qlj">
          <el-input
            v-model="formModel.qlj"
            class="filter-item "
            clearable
          />
        </el-form-item>
        <el-form-item class="no-warn-item" label="后轮距(mm):" prop="hlj">
          <el-input
            v-model="formModel.hlj"
            class="filter-item "
            clearable
          />
        </el-form-item>
        <el-form-item class="no-warn-item" label="轮胎数:" prop="lts">
          <el-input
            v-model="formModel.lts"
            class="filter-item "
            clearable
          />
        </el-form-item>
        <el-form-item class="no-warn-item" label="状态:" prop="status">
          <hey-select v-model="formModel.status" clcd="is_effective_cd" />
        </el-form-item>
        <el-row class="submit-area">
          <el-col :span="24">
            <el-button
              v-if="hasPermission('qualifiedCertificate_select')"
              type="primary"
              plain
              @click="queryList(false)"
            >查询
            </el-button>
            <el-button v-if="hasPermission('qualifiedCertificate_add')" type="primary" plain @click="handleAdd">新增
            </el-button>
          </el-col>
        </el-row>
      </el-form>
    </div>
    <hey-table ref="table" :table-data="tableData" :columns="columns">
      <template slot="tools">
        <el-table-column
          label="操作"
          width="120"
          fixed="right"
          header-align="center"
          align="center"
        >
          <template slot-scope="{row}">
            <span
              v-if="hasPermission('qualifiedCertificate_edit')"
              class="hey_tools_btn"
              @click="handleEdit(row)"
            >编辑</span>
            <span
              v-if="hasPermission('qualifiedCertificate_del')"
              class="hey_tools_btn"
              @click="handleDelete(row)"
            >删除</span>
          </template>
        </el-table-column>
      </template>
    </hey-table>
    <el-dialog
      v-if="dialogVisible"
      v-dialogDrag
      :close-on-click-modal="false"
      title="合格证信息"
      :visible.sync="dialogVisible"
      width="80%"
    >
      <QualifiedCertificate-mnt :page-type="operateType" :edit-data="editData" @mntSuc="queryList" />
    </el-dialog>

  </div>
</template>

<script>

export default {
  name: 'QualifiedCertificateList',
  components: {
    QualifiedCertificateMnt: () => import('./qualifiedCertificate-mnt')
  },
  props: {},
  data() {
    return {
      dialogVisible: false,
      operateType: '',
      editData: {},
      tableData: [],
      // 查询条件
      formModel: {
        qualifiedCertificateNo: '',
        clxh: '',
        zxxs: '',
        qlj: '',
        hlj: '',
        lts: '',
        status: ''
      },
      columns: [
        { title: '合格证编号', key: 'qualifiedCertificateNo' },
        { title: '产品公告号', key: 'cpggh' },
        { title: '公告批次', key: 'ggpc' },
        { title: '公告生效日期', key: 'ggsxrq' },
        { title: '双积分配置ID', key: 'sjfpzid' },
        { title: '企业代码', key: 'qydm' },
        { title: '企业ID', key: 'qyid' },
        { title: '是否使用车型年份', key: 'isCxnf', clcd: 'ind_cd' },
        { title: '车辆状态信息', key: 'clztxxKey', clcd: 'clztxx_cd' },
        { title: '车辆分类', key: 'clflKey', clcd: 'clfl_cd' },
        { title: '底盘ID', key: 'dpid' },
        { title: '底盘合格证编号', key: 'dphgzbh' },
        { title: '底盘型号', key: 'dpxh' },
        { title: '车辆品牌', key: 'clpp' },
        { title: '车辆名称', key: 'clmc' },
        { title: '车辆型号', key: 'clxh' },
        { title: '发动机型号', key: 'fdjxh' },
        { title: '最高车速(KM/H)', key: 'zgcs' },
        { title: '车辆制造企业名称', key: 'clzzqymc' },
        { title: '燃料种类', key: 'rlzl' },
        { title: '纯电动标记', key: 'vehCddbj', clcd: 'ind_cd' },
        { title: '排放标准', key: 'pfbz' },
        { title: '排量(ML)', key: 'pl' },
        { title: '功率(KW)', key: 'gl' },
        { title: '外廓长', key: 'wkc' },
        { title: '外廓宽', key: 'wkk' },
        { title: '外廓高', key: 'wkg' },
        { title: '货厢内部长', key: 'hxnbc' },
        { title: '货厢内部宽', key: 'hxnbk' },
        { title: '货厢内部高', key: 'hxnbg' },
        { title: '钢板弹簧片数(片)', key: 'gbthps' },
        { title: '轮胎数', key: 'lts' },
        { title: '轴距(mm)', key: 'zj' },
        { title: '前轮距(mm)', key: 'qlj' },
        { title: '后轮距(mm)', key: 'hlj' },
        { title: '转向形式', key: 'zxxs' },
        { title: '轴荷(kg)', key: 'zh' },
        { title: '轴数', key: 'zs' },
        { title: '额定载质量(kg)', key: 'hdzzl' },
        { title: '总质量', key: 'zzl' },
        { title: '整备质量', key: 'zbzl' },
        { title: '半挂车鞍座最大允许总质量(KG)', key: 'bgcazzdyxzzl' },
        { title: '载质量利用系数', key: 'zzllyxs' },
        { title: '准牵引总质量(KG)', key: 'zqyzzl' },
        { title: '额定载客', key: 'edzk' },
        { title: '驾驶室准乘人数', key: 'jsszcrs' },
        { title: '接近角/离去角（°）', key: 'jjjLqj' },
        { title: '前悬（mm）/后悬（mm）', key: 'qxHx' },
        { title: '前制动方式', key: 'qzdfs' },
        { title: '后制动方式', key: 'hzdfs' },
        { title: '前制动操作方式', key: 'qzdczfs' },
        { title: '后制动操作方式', key: 'hzdczfs' },
        { title: '油耗', key: 'vehYh' },
        { title: '转向轴个数', key: 'vehZxzgs' },
        { title: '车辆生产单位地址', key: 'clscdwdz' },
        { title: '车辆生产单位名称', key: 'clscdwmc' },
        { title: '企业标准', key: 'qybz' },
        { title: '车辆制造企业其他信息', key: 'clzzqyqtxx' },

        { title: '状态', key: 'status', clcd: 'is_effective_cd' },
        { title: '创建时间', key: 'createTime' },
        { title: '创建人', key: 'createUsername' },
        { title: '最后修改时间', key: 'lastUpdateTime' },
        { title: '最后修改人', key: 'lastUpdateUsername' }
      ]
    }
  },
  computed: {},
  methods: {
    queryList() {
      this.$refs.table.query('/qualifiedCertificate/pageQualifiedCertificate', this.formModel, '', false)
    },
    handleAdd() {
      this.operateType = 'add'
      this.dialogVisible = true
    },
    handleEdit(row) {
      this.dialogVisible = true
      this.operateType = 'edit'
      this.editData = row || {}
    },
    handleDelete(row) {
      this.$sure('确认删除？', _ => {
        this.post('/qualifiedCertificate/delete', {
          qualifiedCertificateId: row.qualifiedCertificateId
        }).then(_ => {
          this.$info('删除成功', this.queryList)
        })
      })
    }
  }
}
</script>
